<template>
	<view class="content">
		<navbarVue :title="title" :icon="icon"></navbarVue>
		
		<!-- 首页 -->
		<indexVue v-show="current == 1"></indexVue>
		
		<!-- 评分 -->
		<scoreVue v-show="current == 2"></scoreVue>
		
		<!-- 发布 -->
		<releaseVue v-show="current == 3"></releaseVue>
		
		<!-- 副本 -->
		<secretRealmVue v-show="current == 4"></secretRealmVue>
		
		<!-- 我的 -->
		<meVue v-show="current == 5"></meVue>
		
		<tabbarVue @change="change"></tabbarVue>
	</view>
</template>

<script>
	const app = getApp()
	// 组件
	import indexVue from '@/pages/tabbar/index/index.vue' // 首页
	import meVue from '@/pages/tabbar/me/me.vue' // 我的
	import releaseVue from '@/pages/tabbar/release/release.vue' // 发布
	import scoreVue from '@/pages/tabbar/score/score.vue' // 评分
	import secretRealmVue from '@/pages/tabbar/secretRealm/secretRealm' // 副本
	import tabbarVue from '../../components/tabbar/tabbar.vue'; // 底部
	import navbarVue from './navbar.vue' // 顶部
	export default {
		components: {
			tabbarVue,
			navbarVue,
			meVue,
			releaseVue,
			scoreVue,
			secretRealmVue,
			indexVue
		},
		data() {
			return {
				come: 1,
				title: '首页',
				icon: 'home',
				current: 4,
				menuInfo: app.globalData.menuInfo
			}
		},
		onShow() {
			if(this.$refs.tabbarRef) {
				this.$refs.tabbarRef.setStartPosition(uni.getStorageSync('come') || 0, 1)
			}
		},
		onLoad() {
		},
		methods: {
			change(e) {
				this.title = e.name
				this.current = e.index
				this.icon = e.navIcon
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #f7f7f7;
	}
</style>
